data modify storage vs:system chain.list append value {}
$data modify storage vs:system chain.list[-1].command set value "$(command)"
$data modify storage vs:system chain.list[-1].id set value "$(id)"
data modify storage vs:system chain.list[-1].player set from entity @s UUID
execute if data entity @s SelectedItem.components."minecraft:custom_data".item.name run data modify storage vs:system chain.list[-1].name set from entity @s SelectedItem.components."minecraft:custom_data".item.name
execute unless data entity @s SelectedItem.components."minecraft:custom_data".item.name run data modify storage vs:system chain.list[-1].name set from entity @s SelectedItem.components."minecraft:custom_data".id

execute if data storage vs:system chain{pushing:true} run return run function vs:chain/push/push_last
execute unless data storage vs:system chain{pushing:true} run return run function vs:chain/start_reaction